<?php
/**
 * 
 * 访客类
 * @author yucy<yucy1985@gmail.com>
 *
 */
class YucyVisitor
{
	private $_attr = array();
	
	private $_identity;
	
	private $_id;
	
	
	/**
	 * 
	 * 获得访客的属性
	 * @param string $name
	 * @return string|null
	 */
	public function getAttr($name)
	{
		return isset($this->_attr[$name]) ? $this->_attr[$name] : null;
	}
	
	
	/**
	 * 
	 * 设置属性
	 * @param string $name
	 * @param mixed $value
	 * @return object
	 */
	public function setAttr($name, $value)
	{
		$this->_attr[$name] = $value;
		
		return $this;
	}
	
	
	/**
	 * 
	 * 清空属性
	 * @return object
	 */
	public function clear()
	{
		$this->_attr = array();
		return $this;
	}
	
	
	/**
	 * 
	 * 获取访客的身份信息
	 * @return mixed
	 */
	public function getIdentity()
	{
		return $this->_identity;
	}
	
	
	/**
	 * 
	 * 设置访客的身份信息
	 * @param mixed $identity
	 */
	public function setIdentity($identity)
	{
		$this->_identity = $identity;
	}
	
	
	public function setId($id)
	{
		$this->_id = $id;
		return $this;
	}
	
	
	public function getId()
	{
		return $this->_id;
	}
}